<template>
  <el-form :model='formData' ref='formData' :rules='rules'>
    <el-form-item label='名称' prop='name'>
      <el-input style='width:200px' v-model='formData.name' />

    </el-form-item>
    <el-form-item label='信息' prop='msg'>
      <el-input style='width:200px' v-model='formData.msg' />
    </el-form-item>
  </el-form>


</template>

<script>
export default {
  name: 'myForm',
  props:["count"] ,
  data() {
    return {
      formData: { name: undefined, msg: undefined },

      rules: {
        name: [{
          required: true, message: 'please input', trigger: 'blur'
        }]
      }
    }
  },
  methods: {
    check() {
      this.$refs["formData"].validate((valid) => {
        if (valid) {
          this.$emit('fatherMethod', {
            state: 'success',
            data: this.formData
          })
        } else {
          this.$emit('fatherMethod', {
            state: 'error',
            data: this.formData
          })
          return false
        }
      })
      console.log("check() ")
    }
  }
}
</script>

<style scoped>

</style>